﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SelectSingleUser.aspx.cs" Inherits="BEGDC.CC.Web.Common.SelectSingleUser" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="System.Web.Extensions" Namespace="System.Web.UI" TagPrefix="atlas" %>
<%@ Register Assembly="Controls" Namespace="Atos.Controls" TagPrefix="cc1" %>
<%@ Register Namespace="nStuff.Samples.AtlasControls" TagPrefix="nk" %>
<%@ Register Namespace="Vela3.Control" TagPrefix="Vela3" %>
<%@ Register Src="~/Common/VelaPagerI.ascx" TagName="VelaPager" TagPrefix="uc" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Select User</title>
    <base target="_self" />

    <script src="../../../App_Themes/Scripts/Script.js" type="text/javascript"></script>

    <script src="../../../Timesheet/select.js" type="Text/javascript"></script>

</head>
<body>
    <form id="form1" runat="server" defaultbutton="btnSearch">
    
    
     
   
    
                            
    <table class="table-stroke1" width="98%" border="0" align="center" cellpadding="0"
        cellspacing="1">
        <tr>
            <td>
                <table class="form_page_title" width="100%" cellspacing="0" cellpadding="0" border="0">
                    <tr>
                        <td class="form_page_title_block">
                        </td>
                        <td class="form_page_title_data">
                            <asp:Label ID="Label5" runat="server" Text="<%$ Resources:VelaLanguage,UserSearch_rand689566 %>" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td  id="subadmin_menu1" style="display: block;" type="hidden">
                <table width="100%" border="0" cellpadding="0" cellspacing="0" class="form_info">
                    <tr>
                        <td class="form_info_title" width="20%" align="left">
                            <asp:Label ID="Label3" runat="server" Text="<%$ Resources:VelaLanguage,UPI_rand923418 %>"></asp:Label>
                        </td>
                        <td class="form_info_item" width="30%" align="left">
                            <asp:TextBox ID="txtUSER_CD" runat="server" CssClass="input_maidle"></asp:TextBox>
                        </td>
                        <td class="form_info_title" width="20%" align="left">
                            <asp:Label ID="Label2" runat="server" Text="<%$ Resources:VelaLanguage,UserName_rand398628 %>"></asp:Label>
                        </td>
                        <td class="form_info_item" width="30%" align="left">
                            <asp:TextBox ID="txtUSER_NAME" runat="server" CssClass="input_maidle"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td class="form_info_title">
                            <asp:Label ID="Label4" runat="server" Text="<%$ Resources:VelaLanguage,Department_rand529724 %>"></asp:Label>
                        </td>
                        <td class="form_info_item">
                            <asp:DropDownList ID="ddlBG" runat="server" CssClass="input_maidle" OnSelectedIndexChanged="ddlBG_SelectedIndexChanged"
                                AutoPostBack="true">
                            </asp:DropDownList>
                        </td>
                        <td class="form_info_title">
                            <asp:Label ID="Label1" runat="server" Text="<%$ Resources:VelaLanguage,Department_rand529725 %>"></asp:Label>
                        </td>
                        <td class="form_info_item">
                            <asp:DropDownList ID="ddlBD" runat="server" CssClass="input_maidle" OnSelectedIndexChanged="ddlBD_SelectedIndexChanged"
                                AutoPostBack="true">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td class="form_info_title">
                            <asp:Label ID="Label7" runat="server" Text="<%$ Resources:VelaLanguage,SubDepartment_rand179598 %>"></asp:Label>
                        </td>
                        <td class="form_info_item_noright" style="border-right-width: 0">
                            <asp:HiddenField ID="HDDEP" runat="server" />
                            <asp:DropDownList ID="ddlDEP" runat="server" CssClass="input_maidle">
                            </asp:DropDownList>
                        </td>
                        <td class="form_info_item" colspan="2" style="text-align:right">
                            <asp:Button ID="btnSearch" runat="server" CssClass="button1" Text="<%$ Resources:VelaLanguage,Query_rand602912 %>"
                                OnClick="btnSearch_Click" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td height="8" align="center" valign="top">
                            <a href='#' onclick="WriteStatus(document.getElementById('HideStatus'))" id="topimg">
                                <img runat="server" id="imgClose" alt='Close' width="53" height="8" hspace='2' border='0'></a>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                <table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">
                    <tr>
                        <td valign="top" align="center">
                           
                                <telerik:RadGrid ID="rgSelectUser" OnSortCommand="rgSelectUser_OnSortCommand" runat="server"
                                    AllowPaging="True" AllowSorting="true" Width="100%" EnableEmbeddedSkins="false"
                                    Skin="Vela" AutoGenerateColumns="False" OnNeedDataSource="rgSelectUser_NeedDataSource">
                                    <HeaderStyle Height="28px" />
                                    <PagerStyle AlwaysVisible="false" />
                                    <FilterMenu Skin="Vela" EnableTheming="True">
                                        <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                                    </FilterMenu>
                                    <ClientSettings EnableRowHoverStyle="true">
                                        <Selecting AllowRowSelect="true" />
                                    </ClientSettings>
                                    <MasterTableView DataKeyNames="USER_ID" AutoGenerateColumns="False" Width="100%"
                                        NoMasterRecordsText="<%$ Resources:VelaLanguage,NoRecords %>">
                                        <RowIndicatorColumn>
                                            <HeaderStyle Width="20px"></HeaderStyle>
                                        </RowIndicatorColumn>
                                        <ExpandCollapseColumn>
                                            <HeaderStyle Width="20px"></HeaderStyle>
                                        </ExpandCollapseColumn>
                                        <Columns>
                                            <telerik:GridTemplateColumn>
                                                <HeaderStyle Wrap="false" HorizontalAlign="center" Width="5%" />
                                                <ItemStyle HorizontalAlign="center" Wrap="False" />
                                                <HeaderTemplate>
                                                    &nbsp;
                                                </HeaderTemplate>
                                                <ItemTemplate>
                                                    <input id="selectUserID" type="radio" value='<%#Eval("USER_ID")+ "$$$"+Eval("ENGLISH_NAME") %>'
                                                        name="selectUserID">
                                                </ItemTemplate>
                                            </telerik:GridTemplateColumn>
                                            <telerik:GridBoundColumn DataField="Account" HeaderText="<%$ Resources:VelaLanguage,Account_rand225823 %>"
                                                SortExpression="Account" UniqueName="Account">
                                                <ItemStyle HorizontalAlign="center" />
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="USER_NAME" HeaderText="<%$ Resources:VelaLanguage,UserName_rand398628 %>"
                                                SortExpression="USER_NAME" UniqueName="USER_NAME">
                                                <ItemStyle HorizontalAlign="center" />
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="USER_CD" HeaderText="<%$ Resources:VelaLanguage,UPI_rand923418 %>"
                                                SortExpression="USER_CD" UniqueName="USER_CD">
                                                <ItemStyle HorizontalAlign="center" />
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="PARTY_NAME" HeaderText="<%$ Resources:VelaLanguage,Department_rand0873828 %>"
                                                SortExpression="PARTY_NAME" UniqueName="PARTY_NAME">
                                                <ItemStyle HorizontalAlign="left" />
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="LEADER_NAME" HeaderText="<%$ Resources:VelaLanguage,ReportTo_rand323557 %>"
                                                SortExpression="LEADER_NAME" UniqueName="LEADER_NAME">
                                                <ItemStyle HorizontalAlign="center" />
                                            </telerik:GridBoundColumn>
                                        </Columns>
                                    </MasterTableView>
                                </telerik:RadGrid>
                                <uc:VelaPager Width="100%" ID="ucPager" ParentGridID="rgSelectUser" Skin="Vela" runat="server"
                                    OnNeedDataSource="ucPager_OnNeedDataSource" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td class="form_info_padding">
                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr align="center">
                        <td>
                            <asp:Button ID="btnSave" runat="server" Text="<%$ Resources:VelaLanguage,Save %>"
                                OnClientClick="SelectUser();" class="button1" TabIndex="0" />
                            &nbsp;
                            <input id="Button3" runat="server" type="button" class="button1" value=" <%$ Resources:VelaLanguage,Close_rand387771 %> "
                                onkeydown="NoClose();" onclick="Close();" tabindex="1" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    
    <asp:HiddenField runat="server" ID="hidAllowEmpty" />
    </form>
</body>
</html>

<script type="text/javascript">
    var strID = '', strName = '';
    function GiveValue() {
        var strlist = '';

        for (var i = 0; i < form1.elements.length; i++) {
            var e = form1.elements[i];
            if (e.type == "radio" && e.checked == true && e.name == "selectUserID") {
                var strlist = e.value.split('$$$');
                strID = strlist[0];
                strName = strlist[1];
                break;
            }
        }

    }

    function SelectUser() {
        GiveValue();

        var e = (window.parent.opener == undefined) ? dialogArguments : window.parent.opener.document;
        var USER_IDCtr = '<%=Request["USER_IDCtr"]%>';
        var USER_NAMECtr = '<%=Request["USER_NAMECtr"]%>';

        if (e.all(USER_IDCtr) != null) {
            e.all(USER_IDCtr).value = strID;
            if (e.all(USER_NAMECtr) != null) {
                e.all(USER_NAMECtr).value = strName;
                e.all(USER_NAMECtr).innerText = strName;
            }
        }
        else {
            var allow = document.getElementById("hidAllowEmpty").value;

            if (strID.length > 0 || allow == "1") {
                window.opener.RefreshUser(strID)
            }
        }
        window.close();

    }
</script>